package com.zpark.signup.utils;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.List;

/**
 * 分页工具类
 */
@ApiModel(value = "分页数据响应对象")
public class RespPageBean implements Serializable {
    private static final long serialVersionUID = 1L;
    //总记录数
    @ApiModelProperty(value = "总记录数", example = "100")
    private long totalCount;

    //每页记录数
    @ApiModelProperty(value = "每页记录数", example = "10")
    private long pageSize;

    //总页数
    @ApiModelProperty(value = "总页数", example = "10")
    private long totalPage;

    //当前页数
    @ApiModelProperty(value = "当前页数", example = "1")
    private long currentPage;

    //列表数据
    @ApiModelProperty(value = "列表数据", example = "[{...}, {...}]")
    private List<?> list;

	public RespPageBean(List<?> list, long totalCount, long pageSize, long currentPage) {
        this.totalCount = totalCount;
        this.pageSize = pageSize;
        this.currentPage = currentPage;
        this.totalPage = (int) Math.ceil((double) totalCount / pageSize);
        this.list = list;
    }

    public long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(long totalCount) {
        this.totalCount = totalCount;
    }

    public long getPageSize() {
        return pageSize;
    }

    public void setPageSize(long pageSize) {
        this.pageSize = pageSize;
    }

    public long getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(long totalPage) {
        this.totalPage = totalPage;
    }

    public long getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(long currentPage) {
        this.currentPage = currentPage;
    }

    public List<?> getList() {
        return list;
    }

    public void setList(List<?> list) {
        this.list = list;
    }

}
